class Plu1 {
    apply(compiler){
         console.log('自定义插件')
    }
}

module.exports=Plu1



/*
let fs=require('fs')
let path=require('path')
let webpack=require('webpack')
let {RawSource}=webpack.sources
class plugin1{
    apply(compiler){
        console.log('plugin-------11')
        this.init(compiler)
        this.emit(compiler)
        this.other(compiler)
    }
    init(compiler){
        compiler.hooks.thisCompilation.tap('plugin1',compilation=>{
            //添加资源
            let content='文本-------------11'
            compilation.hooks.additionalAssets.tapAsync('plugin1',cb=>{
                compilation.assets['a.txt']={
                    size(){
                        return content.length
                    },
                    source(){
                        return content
                    }
                }
                let file=fs.readFileSync(path.join(__dirname,'../file/b.js'),'utf-8')
                console.log(path.basename(path.join(__dirname,'../file/b.js')),'文件名')
                compilation.assets['b.js']=new RawSource(file)

                compilation.emitAsset('c.js',new RawSource(file))
                cb()
            })
            
        })
    }
    emit(compiler){
        compiler.hooks.emit.tap('plugin1',compilation=>{
            console.log('emit')
            // compilation.hooks.thisCompilation.emit.tap('plugin1',()=>{
           
        })
        compiler.hooks.emit.tapAsync('plugin1',(compilation,cb)=>{
            setTimeout(()=>{
                console.log('tapasyc-------00')
                cb()
            },3000)
        })
        compiler.hooks.emit.tapPromise('plugin1',()=>{
            return new Promise(resolve=>{
                setTimeout(()=>{
                    console.log('promise')
                    resolve()
                },3000)
            })
        })
    }
    other(compiler){
        compiler.hooks.afterEmit.tap('plugin1',compilation=>{
            console.log('afterEmit')
        })
        compiler.hooks.done.tap('plugin1',compilation=>{
            console.log('done')
        })
    }
}
module.exports=plugin1
*/